package com.service.impl;

import java.util.List;
import java.util.Map;

import org.apache.log4j.Logger;

import com.bean.TfAccountRecord;
import com.dao.TfAccountRecordDao;
import com.service.TfAccountRecordService;
import com.tool.RegexTool;

public class TfAccountRecordServiceImpl implements TfAccountRecordService {
	private	TfAccountRecordDao dao;
	private Logger log = Logger.getLogger(PayStatisticsServiceImpl.class);
	private static String Tag = PayStatisticsServiceImpl.class.getName();
	@Override
	public String queryByDay(List<TfAccountRecord> payInOut, List<TfAccountRecord> payStat, String daytime)
			throws Exception {
		
		if(RegexTool.checkDateTime(daytime)){
			return dao.queryByDay(payInOut, payStat, daytime);
		}else{
			return "日期错误";
		}
	}

	@Override
	public Double[][] queryByWeek(List<TfAccountRecord> payInOut,
			List<TfAccountRecord> payStat,
			Map<Double, Double> paylistInOutByDay, String daytime)
			throws Exception {
		if(RegexTool.checkDateTime(daytime)){
			return dao.queryByWeek(payInOut, payStat, paylistInOutByDay, daytime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}

	@Override
	public Double[][] queryByMonth(List<TfAccountRecord> payInOut,
			List<TfAccountRecord> payStat,
			Map<Double, Double> paylistInOutByDay, String daytime)
			throws Exception {
		
		if(RegexTool.checkMonth(daytime)){
			return dao.queryByMonth(payInOut, payStat, paylistInOutByDay, daytime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}
	@Override
	public Double[][] queryByYear(List<TfAccountRecord> payInOut,
			List<TfAccountRecord> payStat,
			Map<Double, Double> paylistInOutByMonth, String daytime)
			throws Exception {
		
		if(RegexTool.checkYear(daytime)){
			return dao.queryByYear(payInOut, payStat, paylistInOutByMonth, daytime);
		}else{
			log.error(this.getClass()+".queryByYear() 日期错误");
			return null;// "日期错误";
		}
	}
 

	public TfAccountRecordDao getDao() {
		return dao;
	}

	public void setDao(TfAccountRecordDao dao) {
		this.dao = dao;
	}

}
